-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix/180] Fix offset for vector instructions that operate in private memory space #181
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jjfumero
requested changes
Mar 11, 2022
if (memoryAccess.getIndex() instanceof ConstantValue) { | ||
ConstantValue constantValue = (ConstantValue) memoryAccess.getIndex(); | ||
int parsedIntegerIndex = Integer.parseInt(constantValue.getConstant().toValueString()); | ||
int s = parsedIntegerIndex / oclKind.getVectorLength(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename s
to index
testPrivateVectorDouble8(sequentialOutput); | ||
|
||
for (int i = 0; i < size; i++) { | ||
assertEquals(sequentialOutput.get(i).getS0(), tornadoOutput.get(i).getS0(), 0.001); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a constant for the delta value 0.001
thanks @jjfumero, I made the changes. I also removed the delta from the |
jjfumero
approved these changes
Mar 11, 2022
gigiblender
approved these changes
Mar 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the issue described in #180. The problem is that the compiler was generating the same offset for accessing all the elements within a vector.
For example, if a vector of type
VectorFloat2
has fourFloat2
elements, this should result in the emission of four consecutivevload
andvstore
operations (one per element). In this case the compiler would overwrite and load the data of the first element.This PR resolves this issue by providing a method to calculate the offset and use it when the memory space corresponds to private memory.
In a nutshell, it includes:
OCLArithmeticTool
class.getLength
method forVectorFloat
,VectorInt
,VectorDouble
types, in order to be consistent with other vector types.Backend/s tested
Mark the backends affected by this PR.
OS tested
Mark the OS where this PR is tested.
Did you check on FPGAs?
If it is applicable, check your changes on FPGAs.
How to test the new patch?
This functionality is currently not supported in SPIR-V. We will open a separate PR for this.